feat: buffer map results and move to non-blocking#174
Merged
Conversation
use requestAnimationFrame to handle the parsing and updating of the map in between renderes of the browser also use buffering to add as much points as possible
rubensworks
requested changes
May 5, 2025
|
|
||
| // If the given result contains geospatial data, show it on the map | ||
| _handleGeospatialResult: function (bindings) { | ||
| _process_map_data: function () { |
Member
There was a problem hiding this comment.
Suggested change
| _process_map_data: function () { | |
| _processMapData: function () { |
| if (!this._mapResultsBuffer) this._mapResultsBuffer = []; | ||
| this._mapResultsBuffer.push(bindings); | ||
|
|
||
| requestAnimationFrame(this._process_map_data.bind(this)); |
Member
There was a problem hiding this comment.
We probably need a flag here to call requestAnimationFrame only once. After the callback is invoked, the flag can be reset, to allow future requestAnimationFrame calls.
Contributor
Author
There was a problem hiding this comment.
sure, something like this:
if (this._mapResultsBuffer.length > 0) {
if (!this._processingScheduled) {
this._processingScheduled = true;
requestAnimationFrame(this._processMapData.bind(this));
}
}
rubensworks
reviewed
May 6, 2025
| // Show map if it's not visible yet | ||
| if (!self.$mapWrapper.is(':visible')) | ||
| self.$mapWrapper.show(); | ||
| if (this._mapResultsBuffer.length > 0) { |
Member
There was a problem hiding this comment.
Since we just pushed something to the buffer, this length check can be removed.
Member
|
Nice work @milafrerichs! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
use requestAnimationFrame to handle the parsing and updating of the map in between renderes of the browser
also use buffering to add as much points as possible
Relaxed Issue
#90